<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .list-item {
      width: 400px;
      float: left;
      border: 1px solid red;
      margin: 5px;
    }
  </style>
</head>

<body>
  <div id="app">
    <h1> {{title}}</h1>
    <!-- <ul>
      <li v-for="item in 5">{{item}}</li>
    </ul> -->
    <!-- <div v-for="item in arr1">
      {{item}}
    </div> -->
    <!-- <div class="list-item" v-for="item in goods" v-bind:key="item.gid">
      <h4>{{item.gname}}</h4>
      <p>价格： {{item.gprice}} 元</p>
      <p>重量：{{item.count}} 斤</p>
    </div> -->

    <!-- 如果数据里面每一id这样的唯一的数据，只能用循环的索引：index -->
    <!-- <div v-for="(item,index) in arr1" v-bind:key="index">
      {{item}}
    </div> -->

    <!-- v-for的嵌套使用  -->
    <div class="list-item" v-for="item in teamList" v-bind:key="item.tid">
      <h4>{{item.tname}}</h4>
      <ul>
        <li v-for="el in item.doctors" :key="el.did">医生姓名： {{el.dname}}, 职称： {{el.jname}}</li>
      </ul>
    </div>


  </div>

  <script src="./js/vue.js"></script>
  <script>
    console.log(Vue);
    let vm = new Vue({
      el: "#app",
      data: {
        title: 'v-for循环渲染',
        arr1: ["aaa", 'bbb', 'ccc', 'ddd'],

        goods: [
          { gid: 1, gname: '茄子', gprice: 12, count: 12 },
          { gid: 2, gname: '西瓜', gprice: 22, count: 1 },
          { gid: 3, gname: '冬瓜', gprice: 1, count: 2 },
          { gid: 4, gname: '南瓜', gprice: 2, count: 10 },
        ],
        teamList: [
          {
            tid: 1, tname: '天宇团队', doctors: [
              { did: 1, dname: '张飞宇', jname: '实习生' },
              { did: 2, dname: '尹鹏星', jname: '兽医' }]
          },
          {
            tid: 2, tname: '磊磊团队', doctors: [
              { did: 1, dname: '宋磊', jname: '院子' },
              { did: 2, dname: '廖国锋', jname: '医生' }]
          }

        ]
      },
      methods: {

      },
      computed: {},
      watch: {}
    })

  </script>
</body>

</html>